package com.ruoyi.erp.domain;

import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.utils.StringUtils;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 付款计划对象 payable_plan
 * 
 * @author sauger
 * @date 2022-04-04
 */
@Data
public class PayablePlan extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /**  */
    private Integer id;

    /** 计划名称 */
    @Excel(name = "计划名称")
    private String planName;

    /** 成本中心 */
    @Excel(name = "成本中心")
    private String businessUnitDepartmentName;

    private Integer businessUnitDepartmentId;

    /** 项目 */
    @Excel(name = "项目")
    private String projectName;

    private Integer projectId;

    /** 预计付款时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "预计付款时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date expectTime;

    /** 预计付款金额 */
    @Excel(name = "预计付款金额")
    private BigDecimal expectAmount;

    /** 负责人 */
    @Excel(name = "负责人")
    private Integer manager;

    /** 状态 */
    @Excel(name = "状态")
    private String status;

    /** 备注 */
    private String description;

    /** 付款类型 */
    @Excel(name = "付款类型")
    private String payableType;

    /** 付款类目 */
    @Excel(name = "付款类目")
    private Integer payableCategory;

    /** 创建人ID */
    private Integer createdId;

    /** 创建时间 */
    private Date createAt;

    /** 第几笔付款 */
    @Excel(name = "第几笔付款", dictType = "account_number")
    private Integer planNumber;

    /** 收款人 */
    @Excel(name = "收款人")
    private String receiver;

    /** 审批状态     draft：未提审     review：审核中     pass：已审核    free：免审核 */
    @Excel(name = "审批状态", dictType = "payable_approve_status")
    private String approveStatus;

    /** 审批人 */
    private Long approveBy;

    /** 原因 */
    private String reason;

    //已付金额
    @Excel(name = "已付金额")
    private BigDecimal payedAmount;

    @Excel(name = "最后付款时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date latestPayTime;

    //是否已付清
    private String payedStatus;
     public String getPayedStatus()
     {
         if (StringUtils.isNull(this.payedAmount))
         {
             return "未付清";
         }else
         {
             return this.payedAmount.compareTo(this.expectAmount) == -1 ? "未付清" : "已付清";
         }
     }


}
